﻿#pragma once

#include <iostream>
#include <string>
#include <cstring>

namespace Temp
{
	//抽象的产品类及属性->房子
	class House
	{
	public:
		/***********构造析构*********** */
		House() {}
		~House() {}
		/***********成员函数*********** */
		virtual void RentHouse() = 0;
		/***********GetSet*********** */
		void SetArga(const int arga) { _arga = arga; }
		void SetRent(const int rent) { _rent = rent; }
		/***********Debug*********** */
	protected:
		int _arga;
		int _rent;
	};
	//具体的方法类->房东
	class Landlord :public House
	{
	public:
		/***********构造析构*********** */
		Landlord(const int arga, const int rent)
		{
			SetArga(arga);
			SetRent(rent);
			_introduction += "{\n\t房子的面积是：" + std::to_string(_arga) + "\n";
			_introduction += "\t房子的租金是：" + std::to_string(_rent) + "\n}\n";
		}
		~Landlord() {}
		/***********成员函数*********** */
		void RentHouse() { std::cout << "将房子租出去" << std::endl; }
		/***********GetSet*********** */
		std::string GetIntroduction() { return _introduction; }
		/***********Debug*********** */
	private:
		// introduction 介绍
		std::string _introduction;
	};
	//代理类->中介
	class Intermediary
	{
	public:
		/***********构造析构*********** */
		Intermediary(Landlord& landlord) :_landlord(landlord) {}
		~Intermediary() {}
		/***********成员函数*********** */
		void RentHouse()
		{
			std::cout << "获得房子信息" << std::endl;
			std::string lo_housemessage =_landlord.GetIntroduction();
			std::cout << "带人看房\n"<< lo_housemessage;
			_landlord.RentHouse();
			std::cout << "负责租后维修\n";
		}
		/***********GetSet*********** */
		/***********Debug*********** */
	private:
		Landlord _landlord;
	};
}